Skip to content

Comments

feat: Enhance screenshot functionality with saveTo option and update …#38

Merged
freema merged 1 commit intomainfrom
fix/snapshot-visibility-and-error-handling
Feb 13, 2026
Merged

feat: Enhance screenshot functionality with saveTo option and update …#38
freema merged 1 commit intomainfrom
fix/snapshot-visibility-and-error-handling

Conversation

@freema
Copy link
Owner

@freema freema commented Feb 13, 2026

This pull request introduces a new saveTo parameter for screenshot tools, optimizing screenshot handling especially for CLI-based Model Context Protocol (MCP) clients like Claude Code. Screenshots can now be saved directly to disk, reducing context window bloat. The response format for screenshots has also been improved, and the codebase and tests have been updated to support these changes.

Screenshot tool enhancements:

  • Added an optional saveTo parameter to both screenshot_page and screenshot_by_uid tools, allowing screenshots to be saved to a specified file path instead of returning base64 data in the response. This helps prevent large context payloads in CLI environments. If saveTo is provided, the tool returns a lightweight text response with the file path and size, and automatically creates parent directories as needed. [1] [2] [3] [4] [5] [6]
  • When saveTo is not provided, screenshot responses now use native MCP image content ({ type: "image" }), which GUI clients can render directly. The previous buildScreenshotResponse with token-limit truncation has been removed. [1] [2] [3] [4] [5]

Type and interface updates:

  • Extended the McpToolResponse type to support both text and image content items, ensuring proper typing for the new response formats. [1] [2] [3] [4]

Documentation improvements:

  • Updated README.md and CHANGELOG.md to document the new saveTo parameter, describe its benefits for CLI environments, and explain the new response formats. [1] [2] [3]

Testing enhancements:

  • Added comprehensive unit tests for the new saveTo behavior, including checks for file creation, parent directory creation, and correct response formats for both file and image outputs. [1] [2]

Versioning:

  • Bumped the package and server version to 0.7.0 and updated related tests and constants. [1] [2] [3] [4]…tests

@freema freema merged commit 8aefe29 into main Feb 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant